<?php
/**
 * Created by PhpStorm.
 * User: dllo
 * Date: 16/9/1
 * Time: 16:02
 */

$type = $_POST["type"];
switch ($type){
    case "chouJiang":
        $arr = [0,6,9];
        $index= rand(0,2);
        $num = rand(0,100);
        if($num >= 0 && $num < 5){
            $prize = 1;
        }else if($num >= 5 && $num < 10){
            $prize = 2;
        }else if($num >= 10 && $num < 15){
            $prize = 3;
        }else if($num >= 15 && $num < 20){
            $prize = 4;
        }else if($num >= 20 && $num < 25){
            $prize = 5;
        }else if($num >= 25 && $num < 30){
            $prize = 7;
        }else if($num >= 30 && $num < 35){
            $prize = 8;
        }else if($num >= 35 && $num < 40){
            $prize = 10;
        }else if($num >= 45 && $num < 50){
            $prize = 11;
        }else{
            $prize = $arr[$index];
        }
        $arr = array("err"=>0,"prize"=>$prize);
        echo json_encode($arr);
        break;
}